<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

    <c:forEach items="${resume.projectList}" var="project">
        <c:if test="${!empty project}">
            <div class="pro_info">
            <span><b>${project.name}</b></span>
            <span>&nbsp|&nbsp</span>
            <span class="pro_time"><fmt:formatDate value="${project.startTime}" pattern="yyyy/MM/dd"/>-<fmt:formatDate
                    value="${project.endTime}" pattern="yyyy/MM/dd"/></span></br>
            <span><b>内容：</b>${project.description}</span></br>
            <span><b>项目链接：</b>${project.link}</span>

            <div class="button_edit">
                <button type="button" value="${project.id}" id="button_project_edit_${project.id}"
                onclick="edit_project(this.value)">编辑</button>
            </div>
            <div class="button_del">
                <button type="button" value="${project.id}" id="button_project_del_${project.id}"
                onclick="del_project(this.value)">删除</button>
            </div>
        </div>
        </c:if>
    </c:forEach>
<script>
    function edit_project(obj){
        // let id = obj.value;
        // console.log("id"+id);
        $("#pro_edit").load("/hire/resume/project_edit_update", {id:obj});
        $("#pro_info ").hide();
        $("#pro_edit").show();

    }
    // $("#button_project_edit").click(function () {
    //     let resumeId = $("#resumeId").val();
    //     $("#pro_edit").load("/hire/resume/project_edit", {id: resumeId});
    //     $("#pro_info").hide();
    //     $("#pro_edit").show();
    // })
    // $("#button_project_del").click(function () {
    function del_project(obj){
        console.log(obj)
        let resumeId = $("#resumeId").val();
        // let projectId = obj;
        // console.log("projectId"+projectId)
        $.post('/hire/resume/project/delete',{"projectId":obj},function (res) {
            if (res.code == '200') {
                $("#pro_info").load("/hire/resume/project_info", {id: resumeId});
                // $("#pro_info").remove();
                $("#pro_edit").hide();
            } else {
                layer.msg("删除失败")
            }
        })
    }
    // })
</script>